<div class="contextual">
  <%= link_to l(:label_user_new), {:controller => 'people', :action => 'new', :project_id => @project, :department_id => @department}, :class => 'icon icon-add' if User.current.allowed_people_to?(:add_people, @person) %>
</div>



<div class="filters">   
	<%= form_tag({:contoller => "people", :action => "index"}, :method => :get,  :id => "query_form") do %> 
		<%= hidden_field_tag('project_id', @project.to_param) if @project %>   
		<% no_filters = true %>	
    
    <script type="text/javascript">
       jQuery(function($) {
          // when the #search field changes
          $("#name").observe_field(2, function() {
            var form = $("#query_form"); // grab the form wrapping the search bar.
            var url = form.attr("action");
            var formData = form.serialize();
            $.get(url, formData, function(data) { // perform an AJAX get, the trailing function is what happens on successful get.
                $("#people_list").html(data); // replace the "results" div with the result of action taken
            });
          });
        });
    </script>

    <h2 class="contacts_header">
        <span id='scope_header' class="scope_title"> 
        <%= @group ? @group.name : (@department ? @department.name : l(:label_people))  %>
        </span>

        <span class="live_search">  
            <%= text_field_tag(:name, params[:name], :autocomplete => "off", :class => "live_search_field", :placeholder => l(:label_people_search) ) %>    

        </span>

    </h2>		
	
<!-- 	<fieldset id="filters" class="collapsible <%= 'collapsed' if no_filters %>">
		<legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
		<div style="<%= 'display: none;' if no_filters %>">  
			<p>  

			</p>    

		</div>
	</fieldset> 

	<p class="buttons hide-when-print">
		<%= link_to l(:button_apply), "#", :onclick=>"$('#query_form').submit()", :class => 'icon icon-checked' %>
    	<%= link_to l(:button_clear), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload'  %>
	</p>   
 -->                                                                   
	<% end %>  

</div>

<div id="people_list">  
<% if @people.empty? %>
    <p class="nodata"><%= l(:label_no_data) %></p>
<% else %>
  	<%= render :partial => 'list_excerpt' %>
<% end %>
</div>  

<!-- <PRO> -->
<% other_formats_links do |f| %>
    <%= f.link_to 'CSV', :url => params %>    
<% end if false%>
<!-- </PRO> -->
                     
<% html_title l(:label_people) %>                                                                     

<%= context_menu url_for( {:controller => "people", :action => "context_menu"} )%>  

<% content_for :sidebar do %>
	<div id="people_groups">
		<h3><%= l(:label_people_group_plular) %></h3>
		<ul>
			<li>
				<%= link_to l(:label_people_all), {} %>
			</li>
		<% @groups.each do |group| %>
			<li>
				<%= link_to group.name, {:group_id => group.id}, :class => "#{'selected' if @group && group == @group}"  %>
			</li>	
		<% end %>
		</ul>
	</div>

  <% unless @departments.blank? %>
  <div id="people_departments">
    <div class="contextual">
      <%= link_to l(:button_edit), departments_path if User.current.allowed_people_to?(:edit_departments) %>
    </div>    
    <h3><%= l(:label_department_plural) %></h3>
    <%= department_tree_links(@departments) %>
  </div>  
  <% end %>

  <div id="next_birthdays">
    <h3><%= l(:label_people_next_birthdays) %></h3>
    <%= render :partial => 'person_birthday', :collection => @next_birthdays %>
  </div>

  <div id="new_people">
    <h3><%= l(:label_people_new_people) %></h3>
    <%= render :partial => 'person_data', :collection => @new_people %>
  </div>

<% end %>

<% content_for :header_tags do %>
    <%= javascript_include_tag :people, :plugin => 'redmine_people'  %>
	<%= stylesheet_link_tag :people, :plugin => 'redmine_people' %> 
	<meta name = "format-detection" content = "telephone=no">
<% end %>

